<template>
  <div class="dashboard-editor-container">
    
    <panel-group @handleSetLineChartData="handleSetLineChartData" />

    <el-row :gutter="32" style="">
      <el-col :xs='24' :sm="24" :lg='12'>
          <div class="chart-wrapper">
          <line-chart-two  :chart-data="lineChartData"/>
          </div> 
       </el-col> 
       <el-col :xs='24' :sm="24" :lg='12'>
         <div class="chart-wrapper">
           <line-chart :chart-data="lineChartData" />
         </div>
             
       </el-col>
       
    
    </el-row>
    <el-row :gutter="32">
      <el-col :xs="24" :sm="24" :lg="8">
        <div class="chart-wrapper">
          <raddar-chart />
        </div>
      </el-col>
      <el-col :xs="24" :sm="24" :lg="8">
        <div class="chart-wrapper">
          <pie-chart />
        </div>
      </el-col>
      <el-col :xs="24" :sm="24" :lg="8">
        <div class="chart-wrapper">
          <bar-chart />
        </div>
      </el-col>
    </el-row>
    <div class="footerBottom">
             <div style="color:#666666;background-color:#fafafa;
             font-size:14px;text-align:center;padding:5px" 
      :class="{'fixed-footer':fixedFooter}">
        <div style="margin-bottom:5px">沪ICP备2021007807号-1</div>
        <div>公司地址:上海市浦东新区九州中心1mc01      上海初拾信息技术有限公司</div>
      </div>
    </div>
     
  </div>
</template>

<script>

import PanelGroup from './childComp/PanelGroup'
import LineChart from './childComp/LineChart'
import RaddarChart from './childComp/RaddarChart'
import PieChart from './childComp/PieChart'
import BarChart from './childComp/BarChart'
import BargroupTwo from './bargroup/BargroupTwo'
import BargroupOne from './bargroup/BargroupOne'
import BargroupThree from './bargroup/BargroupThree'
import BargroupFour from './bargroup/BargroupFour'
import LinecChartTwo from './childComp/LineChartTwo'
import LineChartTwo from './childComp/LineChartTwo.vue'
const lineChartData = {
  newVisitis: {
    expectedData: [100, 120, 161, 134, 105, 160, 165],
    actualData: [120, 82, 91, 154, 162, 140, 145]
  },
  messages: {
    expectedData: [200, 192, 120, 144, 160, 130, 140],
    actualData: [180, 160, 151, 106, 145, 150, 130]
  },
  purchases: {
    expectedData: [80, 100, 121, 104, 105, 90, 100],
    actualData: [120, 90, 100, 138, 142, 130, 130]
  },
  shoppings: {
    expectedData: [130, 140, 141, 142, 145, 150, 160],
    actualData: [120, 82, 91, 154, 162, 140, 130]
  }
}

export default {
  name: 'Dashboard',
  components: {
    PanelGroup,
    LineChart,
    RaddarChart,
    PieChart,
    BarChart,
    BargroupTwo,
    BargroupOne,
    BargroupThree,
    BargroupFour,
    LinecChartTwo,
    LineChartTwo
    
  },
  data() {
    return {
      lineChartData: lineChartData.newVisitis
    }
  },
  methods: {
    handleSetLineChartData(type) {
      this.lineChartData = lineChartData[type]
    },
     fixedFooter(){
      return this.$store.state.settings.fixedFooter
    },
  }
}
</script>

<style lang="scss" scoped>
  @import "~@/styles/mixin.scss";
  @import "~@/styles/variables.scss";
.dashboard-editor-container {
  padding: 20px;
  background-color: rgb(240, 242, 245);
  position: relative;

  .github-corner {
    position: absolute;
    top: 0px;
    border: 0;
    right: 0;
  }

  .chart-wrapper {
    background: #fff;
    padding: 16px 16px 0;
    margin-bottom: 32px;
  }
  .fixed-footer{
    position: fixed;
    // top: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    width: calc(100% - #{$sideBarWidth});
    transition: width 0.28s;
    }
    .footerBottom{
      padding:0 20px;
    }
}

@media (max-width:1024px) {
  .chart-wrapper {
    padding: 8px;
  }
}
</style>
